package com.ciaojian.core.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ciaojian.core.model.StoreFirstCost;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 * 加盟门店初始成本表 Mapper 接口
 * </p>
 *
 * @author Atlakyn
 * @since 2021-05-08
 */
public interface StoreFirstCostMapper extends BaseMapper<StoreFirstCost> {

    /**
     * 获取门店的开店成本
     *
     * @param storeId 门店Id
     * @return 门店的初始总投资
     */
    @Select("SELECT ifnull(zhuang_xiu+ruan_zhuang+she_bei+qi_ta,0) AS costTotal FROM d_store_first_cost WHERE store_id = #{storeId} ")
    BigDecimal getCostTotal(@Param("storeId") Integer storeId);
}
